package com.xdcplus.web.common.enums;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 */
public enum McsPathTypeEnum {

    NORMAL( 1,"正常工单"),
    TEST(2,"实验工单"),
    REWORK(3,"返工工单"),
    ;

    private String label;
    private Integer code;
    McsPathTypeEnum(Integer code, String label) {
        this.label = label;
        this.code = code;
    }
    public String getLabel() {
        return label;
    }
    public Integer getCode() {
        return code;
    }

    public static McsPathTypeEnum byCode(Integer code) {
        return Stream.of(values())
                .filter(realStockSettlementOpeEnum -> realStockSettlementOpeEnum.getCode().equals(code))
                .findFirst()
                .get();
    }

    public static List<McsPathTypeEnum> sortByValue() {
        return Stream.of(values())
                .filter(realStockSettlementOpeEnum -> realStockSettlementOpeEnum.getCode()>-1)
                .sorted(Comparator.comparingInt(McsPathTypeEnum::getCode))
                .collect(Collectors.toList());
    }



}
